package cn.yj.relay.common.token;


import cn.yj.relay.common.utils.ServletUtils;

/**
 * <p>
 *
 * </p>
 *
 * @author 永健
 * @since 2019-05-31 14:02
 */
public abstract class AbstractTokenHandler implements TokenHandler
{
    @Override
    public String create(String openId)
    {
        return encryption(doCreate(openId));
    }

    @Override
    public void delete(String openId)
    {
       doDelete(openId);
    }

    @Override
    public String getRequestToken(String token)
    {
        return ServletUtils.getRequest().getHeader(token);
    }

    protected abstract String doCreate(String openId);

    protected abstract void doDelete(String openId);

    protected abstract String encryption(String token);

    protected abstract String decrypt(String token);

}
